//微信支付
function onBridgeReady(appId,timeStamp,nonceStr,package,signType,paySign){
    let params = {
        "appId":appId, //公众号名称，由商户传入
        "timeStamp":timeStamp, //时间戳，自1970年以来的秒数
        "nonceStr":nonceStr, //随机串
        "package":package,
        "signType":signType,//微信签名方式：
        "paySign":paySign //微信签名
    };
    WeixinJSBridge.invoke('getBrandWCPayRequest', params, res => {
        if (res.err_msg == "get_brand_wcpay_request:ok") {
            wePayCallback("ok")
        } else {
            wePayCallback(res.err_msg)
        }
    });
}


function Pay(){
    if (typeof WeixinJSBridge == "undefined"){
       if( document.addEventListener ){
           document.addEventListener('WeixinJSBridgeReady', onBridgeReady, false);
       }else if (document.attachEvent){
           document.attachEvent('WeixinJSBridgeReady', onBridgeReady);
           document.attachEvent('onWeixinJSBridgeReady', onBridgeReady);
       }
    }else{
       onBridgeReady();
    }
}
